<?php
namespace app\index\controller;
use think\Controller;
use think\Request;
use think\Db;
use app\index\model\Personals;
use app\index\model\Users;
class Distance extends Common
{  
	//设置用户的位置接口
	public function get_distance(){
		$uid=input('uid','');//获取用户id
		$longitude=input('longitude','');//获取经度
		$latitude=input('latitude','');//获取纬度
		if(!empty($uid) && !empty($longitude) && !empty($latitude)){
           $rs=Users::selOne($uid);
           if($rs){
           	$data=['longitude'=>$longitude,'latitude'=>$latitude];
             $rd=Personals::Myset($uid,$data);
             if($rd){
               return json(['state'=>'200','msg'=>'修改成功']);	
             }else{
               return json(['state'=>'201','msg'=>'修改失败']);
             }
           }else{
             return json(['state'=>'202','msg'=>'用户不存在']);
           }  
		}else{
			return json(['state'=>'203','msg'=>'参数不足']);
		}
	}
}